package com.flag.liutao.common.handler;

import com.flag.liutao.common.domain.ApiCode;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
public class MyException extends RuntimeException {

    private String msg;
    private int code;

    public MyException(String msg){
        this.code = ApiCode.FAIL.getCode();
        this.msg = msg;
    }

    public MyException(int code,String msg){
        this.code = code;
        this.msg = msg;
    }

    public MyException(ApiCode apiCode){
        this.msg = apiCode.getMessage();
        this.code = apiCode.getCode();
    }


}
